using System;
using System.Collections.Generic;

namespace dbm2.Model
{
    public class Index
    {
        private List<Field> fields;

        public string Description { get; set; }
        public Table ParentTable { get; set; }
        public string Name { get; private set; }


        public Index(string name)
        {
            Name = name;
            fields = new List<Field>();
        }
        
        public void AddField(Field field)
        {
            if(ParentTable.IsContainsField(field) && !fields.Contains(field))
                fields.Add(field);
        }

        public int CountFields()
        {
            return fields.Count;
        }
    }
}